<template>
	<view class="content">
		<button class="button" @click="request">发请求</button>
		<button class="button" @click="forceRefresh">强制刷新缓存</button>
		{{ SPACEINFO }}
	</view>
</template>

<script>
	import multiCloud from "@/multi-cloud.js"
	export default {
		data() {
			return {
				SPACEINFO: {}
			}
		},
		onLoad() {
			this.request();
		},
		methods: {
			request() {
				uniCloud.callFunction({
					name: "test1",
					data: {
						a: 1,
						b: "2"
					},
					success: (res) => {
						console.log('res: ', res.result.SPACEINFO)
						this.SPACEINFO = res.result.SPACEINFO;
					},
					fail: (err) => {
						console.log('err: ', err)
					}
				})
			},
			forceRefresh(){
				multiCloud.forceRefresh();
			}
		}
	}
</script>

<style>
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		padding: 15px;
	}

	.button {
		width: 100%;
		margin-bottom: 10px;
	}
</style>
